The first step in implementing multiple sequence grabber outputs during a single capture session is to create all the sequence grabber outputs. Once the outputs have been created, they must be linked together. This is done using the new SGSetOutputNextOutput routine. The linked outputs are used in link order. An example of creating and linking two sequence grabber outputs is shown in Listing 1 .
Listing 1 Creating and linking sequence grabber outputs
OSErr FSSpecToSGOutput(SeqGrabComponent theSG, FSSpec *fss,
SGOutput *output)
{
OSErr err;
AliasHandle alias = nil;
err = QTNewAlias(&fss, &alias, true);
err = SGNewOutput(theSG, (Handle)alias, rAliasType,
seqGrabToDisk, output);
FSSpec fss;
SGOutput output1, output2;
// create an FSSpec for the first file
FSMakeFSSpec(0, 0, "\pMacintosh HD:Movie 1", &fss);
// create the output for the first file
FSSpecToSGOutput(theSG, &fss, &output1)
// create an FSSpec for the second file
FSMakeFSSpec(0, 0, "\pMacintosh HD:Movie 2", &fss);
//create the output for the second file
FSSpecToSGOutput(theSG, &fss, &output2)
// direct the movie resource to the first file
err = SGSetDataOutput(theSG, fss, seqGrabToDisk);
if (err) goto exit;
// finally, link the outputs
SGSetOutputNextOutput(theSG, output1, output2);
}
In this example two separate outputs are created. Once these outputs are created, they are linked together using SGSetOutputNextOutput . The output output1 is used first. Once that output is full, output2 is used.
Once outputs are created, they must be associated with the sequence grabber channels that write data to these outputs. Listing 2 shows how this can be accomplished. This example shows how to associate the outputs created in Listing 2 with both a sound and a video channel.
Listing 2 Associating outputs with channels
//associate both sound and video channels with all linked outputs
SGSetChannelOutput(theSG, soundChannel, output1);
SGSetChannelOutput(theSG, videoChannel, output1);
You can limit output files to a particular size by specifying the maximum number of bytes to be written to a given sequence grabber output. Listing 3 shows an example of setting a maximum offset of 64 KB for data written to an output.
Listing 3 Specifying maximum data offset for an output
wide maxOffset;
maxOffset.hi = 0;
//set the offset to 64K
maxOffset.lo = 64 * 1024;
SGSetOutputMaximumOffset(theSG, output1, &maxOffset);
| Previous | Chapter Contents | Chapter Top | Next |